package walls.entity;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import walls.constant.MyConstants;

@Data
@Getter
@Setter
public class R {

    private String code;
    private String msg;
    private Object data;

    public static R ok(Object data) {
        R r = new R();
        r.setCode(MyConstants.SUCCESS);
        r.setData(data);
        return r;
    }

    public static R ok() {
        R r = new R();
        r.setCode(MyConstants.SUCCESS);
        return r;
    }
    public static R error(String msg) {
        R r = new R();
        r.setCode(MyConstants.FAIL);
        r.setMsg(msg);
        return r;
    }
    public static R error() {
        R r = new R();
        r.setCode(MyConstants.FAIL);
        return r;
    }
    public static R error(String code, String msg) {
        R r = new R();
        r.setCode(code);
        r.setMsg(msg);
        return r;
    }
}
